#pragma once
#include "../DefinesCore.hpp"
#include "Message.hpp"
#include <string>
#include <vector>

CYBERTRON_BEGIN

class SocketUdpSenderImpl;

class SocketUdpSender
{
public:
	// bSupportMessageSplit=true are only used with pair to SocketUdpReceiver
	CybertronCoreAPI SocketUdpSender(bool bSupportMessageSplit = false, bool bAsyncMode = false);
	CybertronCoreAPI virtual ~SocketUdpSender();

	CybertronCoreAPI bool initialize(const std::string& targetIp, std::uint16_t targetPort, std::uint32_t sendInterval = 10/*us*/);
	CybertronCoreAPI void clear();

	CybertronCoreAPI void send(const std::string& message);
	CybertronCoreAPI void send(const std::vector<std::string>& messages);
	CybertronCoreAPI void send(const Message& msg);

private:
	SocketUdpSender(const SocketUdpSender&);
	SocketUdpSender& operator= (const SocketUdpSender&);

private:
	SocketUdpSenderImpl* mpImpl;
};

CYBERTRON_END
